<?php

/////////////////////////// DISPLAY FUNCTIONS ////////////////////////////////////////

function Update_MainMenu()
{
	print("<a href=\"left.php\" target=\"left\">Click Here to Refresh the Main Menu</a><br>\n");
}

function Input_Width($Name,$Value,$width, $colspan = 1, $max = 50)
{
	print("<td width='30%' colspan='$colspan' ><input type='text' class='formfield' name='$Name'
				checked value='$Value' size='$width' maxlength='$max' ></td>"); 
}

function Input_Width_Span($Name,$Value,$width,$td_width, $max = 50)
{
	print("<td width='$td_width' colspan='3'><input type='text' class='formfield' name='$Name'
				checked value='$Value' size='$width' maxlength='$max' ></td>\n"); 
}

function Print_Input_Box($Label,$Name,$Value)
{
	print("<tr bgcolor=\"#EEEEEF\">");
	print("<td >$Label</td><td bgcolor = \"#FFFFFF\" ><input type=\"text\" class=\"formfield\" name=\"$Name\" value=\"$Value\"></td>\n");
	print("</tr>");
}

function Print_Input_Check($Label,$Name,$Value,$varct)
{
	$chk = "check" . $varct;

	print("<tr bgcolor='#EEEEEF'>");
	print("<td><input type='checkbox' class='formfield' name='$chk' value='1'></td>");
	print("<td>$Label</td><td bgcolor = '#FFFFFF' ><input type='text' class='formfield' name='$Name' value='$Value'></td>\n");
	print("</tr>");
}

function Print_Input_Width($Label,$Name,$Value,$width)
{
	print("<tr bgcolor=\"#EEEEEF\">");
	print("<td >$Label</td><td bgcolor = \"#FFFFFF\" ><input type=\"text\" class=\"formfield\" size='$width' name=\"$Name\" value=\"$Value\"></td>\n");
	print("</tr>");
}

function Print_Input_Special($TopLabel,$Label,$Name,$Value)
{
	Create_Table_With_Options("width='100%' border='0' cellspacing='1' bgcolor='#444466' cellpadding='6' class='normal'");
	print("<tr bgcolor=\"#444466\">");

	print("<td nowrap colspan='2'><font color='#FFFFFF'><b>$TopLabel</b></font></td>");
	Close_Table_Row();
	Create_Table_Row();
	print("<td nowrap bgcolor = '#EFEFEF' >$Label</td>");
	print("<td width ='100%'><input type='text' class='formfield' name='$Name' value='$Value'></td>\n");
	Close_Table_Row();
	Close_Table();
}

function Print_Data_Box($Label,$Name, $Value)
{
	print("<tr bgcolor=\"#EEEEEF\">");
	print("<td >$Label</td>");
	print("<td bgcolor = \"#FFFFFF\" ><b>$Value</b></td>\n");
	print("</tr>\n");

	Print_Hidden_Box($Name,$Value);
}


function Print_Password_Box($Label,$Name,$Value)
{
	print("<tr bgcolor=\"#EEEEEF\">");
	print("<td >$Label</td><td bgcolor = \"#FFFFFF\" ><input type=\"password\" class=\"formfield\" name=\"$Name\" ></td>\n");
	print("</tr>");
}
function Print_YesNo_Box($Label,$Name,$Value)
{
	if ($Value == "1"){
		$ValueZeroStr = "";
		$ValueOneStr = "selected";
	}else{
		$ValueZeroStr = "selected";
		$ValueOneStr = "";
	}
	print("<tr bgcolor=\"#EEEEEF\">\n");
	print("<td >$Label</td><td bgcolor = \"#FFFFFF\" >\n");
	print("<SELECT class=\"formfield\" name='$Name'>\n");
	print("<option value = \"0\" $ValueZeroStr>No</option>\n");
	print("<option value = \"1\" $ValueOneStr>Yes</option>\n");
	print("</select>\n");
	print("</td>\n");
	print("</tr>\n");

}

function Create_Select_Box($Label,$Name)
{
	print("<tr bgcolor=\"#EEEEEF\">\n");
	print("<td bgcolor = \"#EEEEEF\">$Label</td><td bgcolor = \"#FFFFFF\" >\n");
	print("<SELECT class=\"formfield\" name='$Name'>\n");

}

function Create_Select_Check($Label,$Name,$varct)
{
	$chk = "check" . $varct;

	print("<tr bgcolor='#EEEEEF'>");
	print("<td><input type='checkbox' class='formfield' name='$chk' value='1'></td>");
	print("<td>$Label</td><td bgcolor = '#FFFFFF' ><SELECT class='formfield' name='$Name'>\n");
}

function Close_Select_Box(){
	print("</select>\n");
	print("</td>\n");
	print("</tr>\n");
}

function Create_Option($optionname,$optionvalue,$selectedvalue){
	//Selected Value is to check to see whether this Option should be Selected or Not
	if($selectedvalue == $optionvalue){
		$selectstring = "selected";
	}else{
		$selectstring = "";
	}
	print("<option value = \"$optionvalue\" $selectstring>$optionname</option>\n");
}

function Print_Button($button_name, $button_text)
{
	print("<input type=\"submit\" name=\"$button_name\" value=\"$button_text\" class=\"button\">\n");
}

function Print_White_Button($button_name, $button_text)
{
	print("<input type=\"submit\" name=\"$button_name\" value=\"$button_text\" class=\"button_white\">\n");
}
function Print_Red_Button($button_name, $button_text)
{
	print("<input type=\"submit\" name=\"$button_name\" value=\"$button_text\" class=\"button_red\">\n");
}

function Print_Delete_Button($button_name, $button_text)
{
	print("<input type=\"submit\" name=\"$button_name\" onclick=\"return ConfirmDelete()\" value=\"$button_text\" class=\"button\">\n");
}
function Print_DoubleConfirm_Button($button_name, $button_text)
{
	print("<input type=\"submit\" name=\"$button_name\" onclick=\"return ConfirmAction()\" value=\"$button_text\" class=\"button\">\n");
}

function Print_Reset_Button($button_name, $button_text)
{
	print("<input type=\"reset\" name=\"$button_name\" value=\"$button_text\" class=\"button\">\n");
}

function Print_Hidden_Box($Name,$Value)
{
	print("<input type='hidden' name='$Name' value=\"$Value\">\n");
}

// CREATE CUSTOM HTML BASED ON USER LOGIN TYPE


//This Function Creates a BARE HTML Heading
function Create_HTML_Bare()
{
	print ("<html><LINK href=\"stylesheet/main.css\" rel=\"stylesheet\" type=\"text/css\">\n");
}

function Create_HTML()
{
	require_once 'guicomponents/header.php';
}

function Close_HTML()
{
	//PLACE THE BOTTOM INCLUDE BASED ON USERTYPE
	include 'guicomponents/footer.php';
}

//This Function Closes the HTML Heading for each Page
function Close_HTML_Bare()
{
	print ("</html>\n");
}

function Create_Head()
{
	//This Function Creates the HEAD Heading for each Page
	/*
	 print ("<head>\n");
	 print ("<meta http-equiv=\"pragma\" content=\"no-cache\">\n");
	 print ("<meta http-equiv=\"cache-control\" content=\"no-cache\">\n");
	 */
}
function Close_Head()
{
	//This Function Closes the HEAD Heading for each Page
	//print ("</head>\n");
}
function Set_Form_Heading($post_page)
{
	//Set the Page for Post Form
	print("<form method=\"post\" action=\"$post_page\">\n");
}

function Set_Title($title)
{
	// SET TITLE
}

function Set_Meta()
{
	//Creates the Meta for the Page
	//print("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"> \n");
}

function Create_Body()
{
	// <body> is already created in header.
}

function Close_Body()
{
	//print("</body>\n");
}


////////////////////////////// TABLES //////////////////////////////////////

// CREATE TABLE USING STYLE
function Create_Table_Using_Style($style)
{
	print("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" bgcolor=\"#DDDDDD\" style=\"$style\">\n");
}

// CREATE A NEW TABLE - DEFAULT
function Create_Table()
{
	print("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" bgcolor=\"#DDDDDD\" class=\"normal\">\n");
}

// CREATE CUSTOM TABLE WITH OPTIONS
function Create_Table_With_Options($options)
{
	print("<table $options>\n");
}

// CLOSE THE TABLE
function Close_Table()
{
	print("</table><br>\n");
}

// CREATE ROW FOR HEADING OF TABLE, DEFAULT
function Create_Table_Heading_Row()
{
	print ("<tr bgcolor=\"#EEEEEE\" class=\"normal\">\n");
}

// CREATE ROW FOR HEADING OF TABLE, WITH OPTIONS
function Create_Table_Heading_Row_Options( $options )
{
	print ("<tr $options>\n");
}

// CLOSE THE TABLE ROW
function Close_Table_Heading_Row()
{
	print("</tr>\n");
}

// CREATE A ROW FOR HEADING OF TABLE
function Create_Table_Row()
{
	print ("<tr bgcolor=\"#FFFFFF\">\n");
}

// CLOSE TABLE ROW
function Close_Table_Row()
{
	print("</tr>\n");
}

// CREATE A HEADING CELL
function Table_Heading_Cell($cell_text)
{
	print("<td class='normal' nowrap><b>$cell_text</b></td>\n");
}

// CREATE A CELL WITH LINKED TEXT
function Table_Link_Cell($link_text,$cell_text)
{
	print ("<td class='normal'><a href=\"$link_text\">$cell_text</a></td>\n");
}

// CREATE A STANDARD CELL
function Table_Cell($cell_text)
{
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td class='normal' nowrap>&nbsp;</td>\n");
	}
	else
	{
		print("<td class='normal' nowrap>$cell_text</td>\n");
	}
}

// CREATE A STANDARD CELL WITH WIDTH
function Table_Cell_With_Width($cell_text,$width)
{
	if ( !isset($width) )
	{
		$width = "";
	}
	else
	{
		$width = "width=\"$width\"";
	}
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td class='normal' $width nowrap>&nbsp;</td>\n");
	}
	else
	{
		print("<td class='normal' $width nowrap>$cell_text</td>\n");
	}
}

// CREATE A CELL WITH ALIGNMENT
function Table_Cell_With_Alignment($cell_text, $alignment)
{
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td class='normal' nowrap $alignment>&nbsp;</td>\n");
	}
	else
	{
		print("<td class='normal' nowrap $alignment>$cell_text</td>\n");
	}
}

// CREATE A CELL WITH A SPECIFIC COLUMN SPAN
function Table_Cell_Col_Span($cell_text, $colspan)
{
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td class='normal' nowrap colspan=$colspan>&nbsp;</td>\n");
	}
	else
	{
		print("<td class='normal' nowrap colspan=$colspan>$cell_text</td>\n");
	}
}

// CREATE A CELL WITH NO WRAP AND A SPECIFIC COLUMN SPAN
function Table_Cell_Col_Span_Wrap($cell_text, $colspan)
{
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td class='normal' colspan=$colspan>&nbsp;</td>\n");
	}
	else
	{
		print("<td class='normal' colspan=$colspan>$cell_text</td>\n");
	}
}

// CREATE A CUSTOM CELL
function Table_Cell_With_Options($cell_text, $options)
{
	if (!isset($cell_text) || $cell_text == "")
	{
		print("<td $options>&nbsp;</td>\n");
	}
	else
	{
		print("<td $options>$cell_text</td>\n");
	}
}
?>